Learn how to pay gas in ERC20 using Web SDK
Setup Web SDK
Basic unsponsored transaction, paying with ETH
Let's pay the gas with an ERC20 token
useWaasFeeOptions
hook to allow users to pay gas in ERC20.
Behind the scenes, the WaaS connector intercepts this transaction request and triggers the fee confirmation flow.Now that we declared the useWaasFeeOptions
hook, it has set up an effect that overrides the default feeConfirmationHandler
of the WaaS provider adding the possibility to pay with ERC20 tokens.Add a fee token selector (UI)
hasEnoughBalanceForFee
that you can use to inform the user if they have enough balance to pay for the fee as well as a balance
property that contains the balance of the token.